{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Loading Visualization"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "import plotly.offline as py\n",
    "from plotly.graph_objs import *\n",
    "import pandas as pd\n",
    "import math\n",
    "py.init_notebook_mode()\n",
    "\n",
    "# out_file = '../data/ekf_output_1.txt'\n",
    "out_file = '../data/ekf_output_2.txt'\n",
    "\n",
    "my_cols=['px_est','py_est','vx_est','vy_est','px_meas','py_meas','px_gt','py_gt','vx_gt','vy_gt']\n",
    "with open(out_file) as f:\n",
    "    table_ekf_output = pd.read_table(f, sep='\\t', header=None, names=my_cols, lineterminator='\\n')\n",
    "    \n",
    "table_ekf_output"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false,
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "import plotly.offline as py\n",
    "from plotly.graph_objs import *\n",
    "\n",
    "\n",
    "#estimations\n",
    "trace1 = Scatter(\n",
    "    x=table_ekf_output['px_est'],\n",
    "    y=table_ekf_output['py_est'],\n",
    "    xaxis='x2',\n",
    "    yaxis='y2',\n",
    "    name='KF- Estimate'\n",
    ")\n",
    "\n",
    "#Measurements\n",
    "trace2 = Scatter(\n",
    "    x=table_ekf_output['px_meas'],\n",
    "    y=table_ekf_output['py_meas'],\n",
    "    xaxis='x2',\n",
    "    yaxis='y2',\n",
    "    name = 'Measurements',\n",
    "    mode = 'markers'\n",
    ")\n",
    "\n",
    "#Measurements\n",
    "trace3 = Scatter(\n",
    "    x=table_ekf_output['px_gt'],\n",
    "    y=table_ekf_output['py_gt'],\n",
    "    xaxis='x2',\n",
    "    yaxis='y2',\n",
    "    name = 'Ground Truth'\n",
    ")\n",
    "\n",
    "data = [trace1, trace2, trace3]\n",
    "\n",
    "layout = Layout(\n",
    "    xaxis2=dict(\n",
    "   \n",
    "        anchor='x2',\n",
    "        title='px'\n",
    "    ),\n",
    "    yaxis2=dict(\n",
    "    \n",
    "        anchor='y2',\n",
    "        title='py'\n",
    "    )\n",
    ")\n",
    "\n",
    "fig = Figure(data=data, layout=layout)\n",
    "py.iplot(fig, filename= 'EKF')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
